#ifndef OGREREFCONSTANTS_H
#define OGREREFCONSTANTS_H

#include <Ogre.h>
using namespace Ogre;

namespace OgreRefApp
{

    const Real   Pi        = 3.14159;

//a few useful constants
    const int     MaxInt    = (std::numeric_limits<int>::max)();
    const double  MaxDouble = (std::numeric_limits<double>::max)();
    const double  MinDouble = (std::numeric_limits<double>::min)();
    const float   MaxFloat  = (std::numeric_limits<float>::max)();
    const float   MinFloat  = (std::numeric_limits<float>::min)();

    //the number of times the SoccerTeam::CanShoot method attempts to find
    //a valid shot
    const int NumAttemptsToFindValidStrike = 5;


    //use to set up the sweet spot calculator
    const Real NumSweetSpotsX = 13;
    const Real NumSweetSpotsY = 6;

    //these values tweak the various rules used to calculate the support spots
    const Real Spot_CanPassScore                      = 2.0;
    const Real Spot_CanScoreFromPositionScore         = 1.0;
    const Real Spot_DistFromControllingPlayerScore    = 2.0;
    const Real Spot_ClosenessToSupportingPlayerScore  = 0.0;
    const Real Spot_AheadOfAttackerScore              = 0.0;

    //how many times per second the support spots will be calculated
    const Real SupportSpotUpdateFreq           = 1;

    const Real BallRadius = 7;

    const Real BallSize = BallRadius * 2;

    const Real GoalWidth = 200;

    const Vector3  PlayerMaxSpeedWithBall  = Vector3(80,80,80);
    const Vector3 PlayerMaxSpeedWithoutBall = Vector3(80,80,80);
//the minimum distance a receiving player must be from the passing player
    const Real MinPassDistance = 120.0;

    const Real MaxPassingForce = 600;
    const Real MaxShootingForce = 1200;

    const Real MaxDribbleForce = 300;

//this is the chance that a player will receive a pass using the arrive
//steering behavior, rather than Pursuit
    const Real ChanceOfUsingArriveTypeReceiveBehavior = 0.5;

//the minimum distance a player must be from the goalkeeper before it will
//pass the ball
    const Real GoalkeeperMinPassDistance = 50.0;

//this is the distance the keeper puts between the back of the net
//and the ball when using the interpose steering behavior
    const Real GoalKeeperTendingDistance = 20.0;

//when the ball becomes within this distance of the goalkeeper he
//changes state to intercept the ball
    const Real GoalKeeperInterceptRange = 100.0;

    const Real GoalKeeperInterceptRangeSq = GoalKeeperInterceptRange*GoalKeeperInterceptRange;

    //the goalkeeper has to be this close to the ball to be able to interact with it
    const Real KeeperInBallRange =              20.0;
    const Real PlayerInTargetRange =            20.0;

    const Real KeeperInBallRangeSq = KeeperInBallRange*KeeperInBallRange;
    const Real PlayerInTargetRangeSq = PlayerInTargetRange*PlayerInTargetRange;
//how close the ball must be to a receiver before he starts chasing it
    const Real BallWithinReceivingRange = 200.0;
    const Real BallWithinReceivingRangeSq = BallWithinReceivingRange*BallWithinReceivingRange;
//player has to be this close to the ball to be able to kick it. The higher
//the value this gets, the easier it gets to tackle.
    const Real PlayerKickingDistance = 6.0 + BallSize;

    const Real PlayerKickingDistanceSq  = PlayerKickingDistance * PlayerKickingDistance;


//when an opponents comes within this range the player will attempt to pass
//the ball. Players tend to pass more often, the higher the value
    const Real PlayerComfortZone              = 60.0;
    const Real PlayerComfortZoneSq = PlayerComfortZone*PlayerComfortZone;

    const Real FieldWidth = 800;
    const Real FieldHeight = 400;

    const Real TotalXTiles = 6;
    const Real TotalYTiles = 3;

    const Real PlayerHeight = 14;

    const Real TileWidth = FieldWidth / TotalXTiles;
    const Real TileHeight = FieldHeight / TotalYTiles;

    const Real ChancePlayerAttemptsPotShot = 0.1;

    const Real PlayerKickingAccuracy = 0.99;

    const double SEND_MSG_IMMEDIATELY = 0.0;
    const int    NO_ADDITIONAL_INFO   = 0;
    const int    SENDER_ID_IRRELEVANT = -1;

    const int TeamSize = 5;

    enum MessageType
    {
        Msg_ReceiveBall,
        Msg_PassToMe,
        Msg_SupportAttacker,
        Msg_GoHome,
        Msg_Wait
    };


}


#endif
